﻿using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;


public partial class Supervise_ShowImage : System.Web.UI.Page
{
    private void Page_Load(object sender, System.EventArgs e)
    {
        HZ.MBSM.BLL.GraphDataSet.GraphTableDataTable GraphTable=new HZ.MBSM.BLL.GraphDataSet.GraphTableDataTable();
        ShowImage1(GraphTable);
    }
    public void ShowImage1(HZ.MBSM.BLL.GraphDataSet.GraphTableDataTable GraphTable)
    {
        if (Request.QueryString["V1"] != null && Request.QueryString["V1"] != "")
        {
            Bitmap m_bmp = new Bitmap(200, 200);
            Graphics m_gp = Graphics.FromImage(m_bmp);
            SolidBrush redbrush = new SolidBrush(Color.Red);
            SolidBrush yellowbrush = new SolidBrush(Color.Yellow);
            SolidBrush bluebrush = new SolidBrush(Color.Blue);
            SolidBrush whitebrush = new SolidBrush(Color.White);
            Pen blackpen = new Pen(Color.Black, 2);

            m_gp.FillRectangle(whitebrush, 0, 0, 200, 200);

            m_gp.DrawLine(blackpen, new Point(0, 175), new Point(175, 175));
            m_gp.DrawLine(blackpen, new Point(5, 5), new Point(5, 200));

            Single m_tt = 1;
            Single m_t1 = Convert.ToSingle(Request.QueryString["V1"]);
            Single m_t2 = Convert.ToSingle(Request.QueryString["V2"]);
            Single m_t3 = Convert.ToSingle(Request.QueryString["V3"]);
            Single m_h1 = 1;
            Single m_h2 = 1;
            Single m_h3 = 1;

            if (m_t1 > m_t2)
            {
                m_tt = m_t1;
            }
            else
            {
                m_tt = m_t2;
            }
            if (m_tt > m_t3)
            { }
            else
            {
                m_tt = m_t3;
            }
            if (m_tt == 0)
            {
                m_tt = 1;
            }

            m_h1 = (m_t1 / m_tt) * 190;
            m_h2 = (m_t2 / m_tt) * 190;
            m_h3 = (m_t3 / m_tt) * 190;
            Font font = new System.Drawing.Font("Arial", 9, (System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic));
            System.Drawing.Drawing2D.LinearGradientBrush brush = new System.Drawing.Drawing2D.LinearGradientBrush(new Rectangle(10, 100, 50, 50), Color.Blue, Color.DarkRed, 1.2f);

            m_gp.FillRectangle(redbrush, 10, 174 - m_h1, 50, m_h1);
            m_gp.DrawString("2009-9-9", font, brush, 10, 176);
            m_gp.FillRectangle(yellowbrush, 70, 174 - m_h2, 50, m_h2);
            System.Drawing.Drawing2D.LinearGradientBrush brush1 = new System.Drawing.Drawing2D.LinearGradientBrush(new Rectangle(70, 20, 50, 50), Color.Blue, Color.DarkRed, 1.2f);

            m_gp.DrawString("2008-9-9", font, brush1, 70, 174 - m_h2);
            m_gp.FillRectangle(bluebrush, 130, 174 - m_h3, 50, m_h3);
            System.Drawing.Drawing2D.LinearGradientBrush brush2 = new System.Drawing.Drawing2D.LinearGradientBrush(new Rectangle(130, 20, 50, 50), Color.Blue, Color.DarkRed, 1.2f);

            m_gp.DrawString("2007-9-9", font, brush2, 130, 174 - m_h3);


            Response.ContentType = "image/gif";

            m_bmp.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Gif);
        }
    }

}
